package utils.sound;

public class RMS {

	/*
	 * @nums : array contains double values
	 * @return : The root square mean square of the array. 
	 * See : http://en.wikipedia.org/wiki/Root_mean_square
	 */
    public static double rms(double[] nums){
        double ms = 0;
        for (int i = 0; i < nums.length; i++)
            ms += nums[i] * nums[i];
        ms /= nums.length;
        return Math.sqrt(ms);
    }
}
